<template>
  <div>
    <!-- <div class="draw">
      <img
        class="loading"
        src="../assets/loading/Fg7PS0IesulBHFZwCvfx9-pj6fgs.gif"
        alt=""
      />
    </div> -->
    <div class="draw">
      <div class="draw-list" v-for="(de, di) in moviesData" @click="jumpDetail(de.id)" :key="di">
        <div class="list">
          <!-- <img :src="`${de.img.replace(/w.h/, '570.400')}`" alt="" /> -->
          <img v-lazy="de.img.replace(/w.h/, '570.400')" :key="de.img"/>
          <div class="txt">
            <!-- 上 -->
            <div class="txt-top">
              <div class="txt-top-1">
                <p class="top-p1">{{ de.nm }}</p>
                <p class="top-p2">{{ de.wish }}人想看</p>
              </div>
              <span class="txt-top-2">{{de.sc == 0? '暂无评分':'评分:'+de.sc}}</span>
            </div>
            <!-- 中 -->
            <div class="txt-center">
              <p class="center-p1">
                <span class="center-s1">电影</span>
                {{ de.cat }}
              </p>
              <p
                class="center-p2"
                :style="`${
                  de.hasOwnProperty('showStateButton')
                    ? 'background:#3C9FE6'
                    : 'background:#F03D37'
                }`"
              >
                {{
                  de.hasOwnProperty("showStateButton") == true ? "预售" : "购票"
                }}
              </p>
            </div>
            <!-- 下 -->
            <div class="txt-bottom">
              <p>主演:{{ de.star }}</p>
              <!-- <p>{{ de.comingTitle }}</p> -->
              <p>{{de.hasOwnProperty('showInfo') == true? de.showInfo:de.comingTitle}}</p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ["moviesData"],
  data() {
    return {
      // moviesData: [],
      loadState: -1, //loading状态
    };
  },
  methods:{
    jumpDetail(k) {
      console.log(k);
      this.$router.push({ path: "/detail", query: { id: k } });
    },
  },
  mounted() {
    setTimeout(() => {
      console.log("当前数据----", this.moviesData);
    }, 2000);
  },
};
</script>


<style lang="scss" scoped>
// 渲染数据
.draw {
  width: 100%;
  //   background: rgb(177, 177, 177);
  .loading {
    width: 100%;
  }
  .draw-list {
    // border-radius: 7px;
    width: 100%;
    background: rgb(243, 243, 243);
    .list {
      width: 352px;
      padding: 7px 0;
      margin: 14px auto;
      display: flex;
      justify-content: space-between;
      img {
        width: 80px;
        height: 110px;
        border-radius: 6px;
        object-fit: cover;
      }
      // 文本区
      .txt {
        width: 255px;
        // 上
        .txt-top {
          width: 100%;
          height: 40px;
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          align-content: flex-start;
          .txt-top-1 {
            display: flex;
            justify-content: space-between;
            .top-p1 {
              font-size: 16px;
              color: #000;
              font-weight: bold;
            }
            .top-p2 {
              font-size: 14px;
              color: #ffa82e;
            }
          }
          .txt-top-2 {
            display: inline-block;
            font-size: 12px;
            flex-wrap: 300;
          }
        }
        // 中
        .txt-center {
          margin: 3px 0;
          display: flex;
          justify-content: space-between;
          align-items: center;
          .center-p1 {
            font-size: 14px;
            .center-s1 {
              font-size: 10px;
              box-sizing: border-box;
              color: #67a6ff !important;
              border-radius: 3px;
              border: 1px solid #85a9da !important;
            }
          }
          .center-p2 {
            padding: 6px 14px;
            border-radius: 18px;
            font-size: 14px;
            background: #faaf00;
            color: rgb(245, 245, 245);
          }
        }

        // 下
        .txt-bottom {
          p {
            font-size: 10px;
            padding: 3px 0;
          }
        }
      }
    }
  }
}
</style>